package com.xbongbong.saas.enums.mini;

import com.xbongbong.i18n.util.I18nMessageUtil;
import lombok.Getter;
import lombok.ToString;

/**
 * 应用模块名称<p>
 * 代码描述<p>
 * Company: 逍邦网络科技有限公司<p>
 *
 * @author chenshan
 * @version v1.0
 * @since 2020/9/3 1:41 下午
 */
@Getter
@ToString
public enum DingReportTypeEnum {
    
    ORDER_QUANTITY(1,"enum.dingreport.name.ding_report_name_to_play_signle","enum.dingreport.describe.ding_report_name_to_play_signle"),
    SUCCESS_TRANSACTION(2,"enum.dingreport.name.ding_report_name_clinch","enum.dingreport.describe.ding_report_describe_clinch"),
    /**
     * 未知规则,当异常时用于返回
     */
    UNKNOWN(404, "","");
    ;
    
    private Integer code;
    
    private String name;
    
    private String describe;
    
    DingReportTypeEnum(Integer code,String name, String describe){
        this.code= code;
        this.name= name;
        this.describe= describe;
    }
    
    public static DingReportTypeEnum getByCode(Integer code) {
        for (DingReportTypeEnum cacheCode : values()) {
            if (cacheCode.getCode().equals(code)) {
                return cacheCode;
            }
        }
        return UNKNOWN;
    }
    public String getName() {
        return I18nMessageUtil.getMessage(name);
    }
    
    public String getDescribe() {
        return I18nMessageUtil.getMessage(describe);
    }
}
